package com.inspector.app.ui.flight.mapsearch.poi;

import android.text.SpannableStringBuilder;

import com.inspector.app.di.location.CustomCoordinateType;
import java.util.Objects;


/**
 * MapSearch实体类
 *
 * @author pank 2023/4/3
 */
public class MapSearchPoi {

    private String id;          //[数据id，用来其他操作]
    private String markerId;    //[添加到图层后进行设置,仅用在删除marker处,避免其他图层markerID混淆]
    private int tabType;        //[当前搜索Tab类型, 0 搜坐标 依此类推]
    private String name;        //[名称]
    private String itemType;    //[数据类型 航点、航点等 与MapLayerInstance一一对应]
    private int iconType;       //[图标类型]
    private CustomCoordinateType coordType;    //[坐标系类型]
    private double lat;
    private double lng;

    private int searchNameWeight; //[搜索文字权重]
    private SpannableStringBuilder colorSpan;  //[搜索文本颜色显示]

    // 2023/7/12 [路线规划-新增数据来源]
    /*private transient PathPlanningKey planningKey;
    public void setPlanningKey(PathPlanningKey planningKey) {
        this.planningKey = planningKey;
    }
    public PathPlanningKey getPlanningKey() {
        return planningKey;
    }*/

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setMarkerId(String markerId) {
        this.markerId = markerId;
    }

    public String getMarkerId() {
        return markerId;
    }

    public int getTabType() {
        return tabType;
    }

    public void setTabType(int tabType) {
        this.tabType = tabType;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getItemType() {
        return itemType;
    }

    public void setItemType(String itemType) {
        this.itemType = itemType;
    }

    public int getIconType() {
        return iconType;
    }

    public void setIconType(int iconType) {
        this.iconType = iconType;
    }

    public void setCoordType(CustomCoordinateType coordType) {
        this.coordType = coordType;
    }
    public CustomCoordinateType getCoordType() {
        return coordType;
    }

    public double getLat() {
        return lat;
    }

    public void setLat(double lat) {
        this.lat = lat;
    }

    public double getLng() {
        return lng;
    }

    public void setLng(double lng) {
        this.lng = lng;
    }

    public void setSearchNameWeight(int searchNameWeight) {
        this.searchNameWeight = searchNameWeight;
    }

    public int getSearchNameWeight() {
        return searchNameWeight;
    }

    public void setColorSpan(SpannableStringBuilder colorSpan) {
        this.colorSpan = colorSpan;
    }

    public SpannableStringBuilder getColorSpan() {
        return colorSpan;
    }


    /*public Point swapPoint() {
        Point pointBean = new Point();
        pointBean.setId(this.id);
        pointBean.setName(this.name);
        pointBean.setType(this.iconType);
        pointBean.setLat((float) this.lat);
        pointBean.setLng((float) this.lng);
        pointBean.setLatString(LocationUtils.D2Dms(this.lat));
        pointBean.setLngString(LocationUtils.D2Dms(this.lng));
        pointBean.setSearchNameWeight(this.searchNameWeight);
        pointBean.setColorSpan(this.colorSpan);
        return pointBean;
    }

    public LinePoint swapLinePoint() {
        LinePoint mapPoint = new LinePoint();
        mapPoint.setId(this.id);
        mapPoint.setPointId(this.id);
        mapPoint.setName(this.name);
        mapPoint.setLat(this.lat);
        mapPoint.setLng(this.lng);
        mapPoint.setLatString(LocationUtils.D2Dms(this.lat));
        mapPoint.setLngString(LocationUtils.D2Dms(this.lng));
        mapPoint.setType(String.valueOf(this.iconType));
        mapPoint.colorSpan = this.colorSpan;
        if (this.planningKey != null) {
            mapPoint.setPlanningKeyValue(this.planningKey.getValue());
        }
        return mapPoint;
    }*/

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MapSearchPoi that = (MapSearchPoi) o;
        return tabType == that.tabType && iconType == that.iconType && Double.compare(lat, that.lat) == 0 && Double.compare(lng, that.lng) == 0 && searchNameWeight == that.searchNameWeight && Objects.equals(id, that.id) && Objects.equals(markerId, that.markerId) && Objects.equals(name, that.name) && Objects.equals(itemType, that.itemType) && coordType == that.coordType && Objects.equals(colorSpan, that.colorSpan);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, markerId, tabType, name, itemType, iconType, coordType, lat, lng, searchNameWeight, colorSpan);
    }

    @Override
    public String toString() {
        return "MapSearchPoi{" +
                "id='" + id + '\'' +
                ", markerId='" + markerId + '\'' +
                ", tabType=" + tabType +
                ", name='" + name + '\'' +
                ", itemType='" + itemType + '\'' +
                ", iconType=" + iconType +
                ", coordType=" + coordType +
                ", lat=" + lat +
                ", lng=" + lng +
                ", searchNameWeight=" + searchNameWeight +
                ", colorSpan=" + colorSpan +
                '}';
    }
}
